package com.example.xsssglxt.mapper;

import com.example.xsssglxt.entity.Sushe;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface SusheMapper {
@Select("select * from sushe where number like concat ('%',#{number},'%') limit #{pageNum} ,#{pageSize}")
@Results(value =  {
        @Result(column = "create_time", property = "create_time", javaType = LocalDateTime.class, jdbcType = JdbcType.TIMESTAMP),
        @Result(column = "update_time", property = "update_time", javaType = LocalDateTime.class, jdbcType = JdbcType.TIMESTAMP)
})
    List<Sushe> selectpage(Integer pageNum,Integer pageSize ,String number);
@Select("select count(*) from sushe where number like concat ('%',#{number},'%')")
    Integer total(String number);
    @Select("select * from sushe ")
    @Results(value =  {
            @Result(column = "create_time", property = "create_time", javaType = LocalDateTime.class, jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "update_time", property = "update_time", javaType = LocalDateTime.class, jdbcType = JdbcType.TIMESTAMP)
    })
    List<Sushe> selectall();
@Insert("insert into sushe(number,louyuname,louyuid,sslc,maxlive,haslive) VALUES (#{number},#{louyuname},#{louyuid},#{sslc},#{maxlive},#{haslive})")
    int insert(Sushe sushe);
@Update("update sushe set number=#{number},louyuname=#{louyuname},louyuid=#{louyuid},sslc=#{sslc},maxlive=#{maxlive},haslive=#{haslive} where id=#{id} ")
 int update(Sushe sushe);
@Delete("delete from sushe where id=#{id}")
    int deleter(Integer id);
}

